#ifndef __GUARD_H__
#define __GUARD_H__

#define TIME_CHECK_REBOOT	3				//检查重启信号周期
#define TIME_CHECK_SYSTEMUPDATE	3		//检查系统更新信号周期
#define TIME_CHECK_RUN	30					//检查APP运行信号周期

#define LOG_FILES_MAX	30					//最大log文件数量
#define LOG_FILE_BASE "/tmp/ftp/system/log/log"	//log文件名
#define LOG_FILE_FIRST "/tmp/ftp/system/log/log.0" //第一个log文件
#define LOG_FILE_LAST "/tmp/ftp/system/log/log.30" //最后一个log文件 
#define ROOT_SYSTEM	"/tmp/ftp/system/"		//系统目录
#define ROOT_LOG		"/tmp/ftp/system/log"	//log文件目录

#define LOG_DIR_EXIST 		1
#define LOG_DIR_NOTEXIST	0

#define CHECK_ENABLE		1
#define CHECK_DISABLE	0

#define APP_RUN_FILE "/tmp/run.in"	//app运行信号正常文件
#define SYSTEM_UPDATE_FILE	"/tmp/ftp/system/systemupdate.in" //系统更新信号文件
#define SYSTEM_REBOOT_FILE "/tmp/ftp/system/reboot.in"  //系统重启信号文件



#define CONSOLE_BASE		0x1F00000
#define CONSOLE_INDEX	0x1FFFFF0


#define CLKSEL 	0xFFF0000C
#define SOFTRESET	0x00000001	

#define outp(port,value)	*((volatile unsigned char *)(port)) = value
#define outpdw(port,value)	*((volatile short *)(port)) = value
#define outpw(port, value) *((volatile unsigned int *)(port)) = value

#define inp(port)		*((volatile unsigned char *)(port))
#define inpdw(port)	*((volatile short *)(port))
#define inpw(port)	*((volatile unsigned int *)(port))

extern void CheckLogDir(void);
extern int CheckLogFiles(void);
extern void DelaySec(int sec);
extern void SystemReboot(void);
extern void SaveLast1MB(void);
extern void CheckAppRun(void);
extern void CheckSystemUpdate(void);
extern void CheckReboot(void);

#endif
